/**
 * All Rights Reserved , Copyright (C) 2021 , 青岛鼎信通讯股份有限公司
 *
 *MpmProjectCirculatedMemberController
 * 项目传阅反馈人员表
 *
 * 修改纪录
 * 2021-07-14 版本：1.0 chengengwei 创建。
 * @version 版本：1.0
 * @author 作者：chengengwei
 * 创建日期：2021-07-14
 */

package com.topscomm.mpm.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.topscomm.basic.exception.MessageException;
import com.topscomm.mpm.pojo.MpmProjectCirculatedMemberEntity;
import com.topscomm.pub.util.ConvertUtil;
import com.topscomm.tap.util.ErrorLogUtil;
import org.springframework.web.bind.annotation.*;

import com.topscomm.mpm.controller.auto.MpmProjectCirculatedMemberControllerAuto;
import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.pub.util.StringUtil;
import com.topscomm.pub.vo.ResponseResult;

/**
 * @author: chengengwei
 * @date: 2021-07-14
 * @description:项目传阅反馈人员表Controller
 * @modify:
 */
@RestController
@RequestMapping("mpm/projectCirculatedMember")
public class MpmProjectCirculatedMemberController extends MpmProjectCirculatedMemberControllerAuto implements IMpmProjectCirculatedMemberController {
	/**
	 * @author: chengengwei
	 * @date: 2021-07-14
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	protected String spellListSql(Map<String, Object> paraMap) {
		StringBufferProxy sql = new StringBufferProxy();
		sql.appendSingle(" 1=1 ");
		if (paraMap.containsKey("qry_sourceid")) {
			String value = paraMap.get("qry_sourceid").toString();
			if (!StringUtil.isEmpty(value))
				sql.appendSingle(" and sourceid = {0} ", value);
		}
		return sql.toString();
	}

	/**
	 * @author: chengengwei
	 * @date: 2021-07-14
	 * @param paraMap
	 * @return
	 * @description:转换出查询SQL语句
	 * @modify:
	 */
	@Override
	@GetMapping(value = "/refList")
	public ResponseResult<Object> refList(@RequestParam(required = false) Map<String, Object> paraMap) {
		return super.refList(paraMap);
	}

	/**
	 * @author: chengengwei
	 * @date: 2021-07-15
	 * @description:保存项目成员数据
	 * @modify:
	 */
	@PostMapping(value = "/saveMemberData")
	public ResponseResult<Object> saveMemberData(@RequestBody(required = false) Map<String, Object> paraMap) {
		this.service.saveMemberData(paraMap);
		return ResponseResult.ok("保存成功");
	}

	/**
	 * @author: chengengwei
	 * @date: 2021-07-15
	 * @description:查询项目成员名单
	 * @modify:
	 */
	@GetMapping(value = "/queryConfirmMemberList")
	public ResponseResult<Object> queryConfirmMemberList(@RequestParam(required = false) Map<String, Object> paraMap) {
		List<Map<String, Object>> dataList = this.service.queryConfirmMemberList(paraMap);
		Map<String, Object> resultMap = new HashMap<>();
		resultMap.put("dataList", dataList);
		return ResponseResult.ok(resultMap);
	}

	/**
	 * @author: chengengwei
	 * @date: 2021-07-16
	 * @description:根据sourceid查询项目成员信息
	 * @modify:
	 */
	@GetMapping(value = "/loadCirculatedMemberInfoBySourceId")
	public ResponseResult<Object> loadCirculatedMemberInfoBySourceId(@RequestParam(required = false) Map<String, Object> paraMap) {
		Map<String, Object> dataMap = this.service.loadCirculatedMemberInfoBySourceId(paraMap);
		return ResponseResult.ok(dataMap);
	}
}

